import { App } from "@vue/runtime-dom";
const requireFolderName = (r) => {
  const contents = {};
  for (const p in r) {
    const fn = r[p].default;
    const _array = p.split("/");
    const index = _array.findIndex((item) => item === "index.vue");
    contents[_array[index - 1]] = fn;
  }
  return contents;
};

const components = requireFolderName(import.meta.globEager("./*/index.vue"));
export default {
  install(vm: App) {
    for (const comp in components) {
      vm.component(comp, components[comp]);
    }
  },
};
